package jplat.tools.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import jplat.base.constant.KTraceLog;
import jplat.tools.string.JLogUtils;
import jplat.tools.string.XLog;

public class JConfigUtils
{
	public static Properties loadPropertis( String proPath )
	{
		XLog.log(JLogUtils.getTraceLog(KTraceLog.ACTION_JINIT, KTraceLog.EVENT_START, "", "load:"+proPath));
		
		InputStream is = JConfigUtils.class.getClassLoader().getResourceAsStream(proPath);
		Properties prop = new Properties();
		try {
			prop.load(is);
//			is.close();

			XLog.log(JLogUtils.getTraceLog(KTraceLog.ACTION_JINIT, KTraceLog.EVENT_SUCCESS, "", "load:"+proPath));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally
		{
			if ( is != null )
			{
				try {
					is.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}

		return prop;
	}
}
